﻿using KeYan.Service.Common.Enum;
using KeYan.Service.IRepository.OrderFrom;
using KeYan.Service.Model.OrderForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KeYan.Service.Repository.OrderFrom
{
    public class OrderFromRepository : OrderFromIRepository
    {
        KeYanContext context = new KeYanContext();
        /// <summary>
        /// 添加订单
        /// </summary>
        /// <returns></returns>
        public Task<Resilt<int>> AddOrder(OrderInfo orderInfo)
        {
            throw new NotImplementedException();
        }
        /// <summary>
        /// 查询订单
        /// </summary>
        /// <param name="orderNumber">订单编号</param>
        /// <param name="serviceName">服务名称</param>
        /// <returns></returns>
        public List<OrderInfo> SelOrder(string orderNumber, int ServeId)
        {
            var list = context.tb_user_service_orders.ToList();
            if (!string.IsNullOrEmpty(orderNumber))
            {
                list = list.Where(s => s.OrderNumber.Equals(orderNumber)).ToList();
            }
            if (ServeId>0)
            {
                list = list.Where(s => s.ServeId.Equals(ServeId)).ToList();
            }
            return list;
        }
        /// <summary>
        /// 通过id进行软删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Task<Resilt<int>> SoftDelOrder(int id)
        {
            throw new NotImplementedException();
        }
    }
}
